using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class UserControls_NewProduct : System.Web.UI.UserControl
{   
    string lastProductID = CatalogAccess.GetLastAddedProduct().ToString();
    protected void Page_Load(object sender, EventArgs e)
    {
        // stores product details
        ProductDetails pd;
        // Retrieve product details
        pd = CatalogAccess.GetProductDetails(lastProductID);
        productNameLink.Text = pd.Name;
        productPriceLink.Text = String.Format("{0:c}", pd.Price);
        
        lastProductImage.ImageUrl = "~/Images/Thumbs/" + pd.Image1FileName.ToString();
        productImageLink.NavigateUrl = "~/Product.aspx?ProductID=" + lastProductID;
        productNameLink.NavigateUrl = "~/Product.aspx?ProductID="+lastProductID;
        productPriceLink.NavigateUrl = "~/Product.aspx?ProductID=" + lastProductID;
    }
}
